const express = require('express')
const router = express.Router()

const chat_handler = require("../router_handler/chat");
// 处理图片文件中间件
const multer = require('multer')
const path = require('path')

// 创建 multer 的实例对象
const storage = multer.diskStorage({
    destination: (req , file , cb )=>{
        cb(null , path.join(__dirname , '../uploads/audio'));
    },
    filename: function (req, file, cb) {
        cb(null, file.originalname)
    }
})
const upload = multer({storage: storage})
// 获取评论
router.post('/lover', chat_handler.getChatsAll)

// 上传音频
router.post('/audio',upload.single('file'),  chat_handler.getChatsAudio)
module.exports = router
